-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') function Change(id,post) local r=edcb.GetReserveData(id) if r then if mg.get_var(post,'start-y') then r.startTime={ year=GetVarInt(post,'start-y',1900,3000), month=GetVarInt(post,'start-m',1,12), day=GetVarInt(post,'start-d',1,31), hour=GetVarInt(post,'start-h',0,23), min=GetVarInt(post,'start-i',0,59), sec=GetVarInt(post,'start-s',0,59) } local endHour=GetVarInt(post,'end-h',0,23) local endMin=GetVarInt(post,'end-i',0,59) local endSec=GetVarInt(post,'end-s',0,59) --正当な日時か検査 if r.startTime.year and r.startTime.month and r.startTime.day and r.startTime.hour and r.startTime.min and r.startTime.sec and os.time(r.startTime) and endHour and endMin and endSec then --プログラム予約化 r.eid=65535 r.durationSecond=(endHour-r.startTime.hour)*3600+(endMin-r.startTime.min)*60+endSec-r.startTime.sec r.durationSecond=r.durationSecond+(r.durationSecond<0 and 24*3600 or 0) return edcb.ChgReserveData(r) end else local presetID=GetVarInt(post,'presetID',0,65534) if presetID then r.recSetting=nil for i,v in ipairs(edcb.EnumRecPresetInfo()) do if v.id==presetID then r.recSetting=v.recSetting break end end end if r.recSetting then local useMargin=GetVarInt(post,'useDefMarginFlag')~=1 or nil r.recSetting={ batFilePath=r.recSetting.batFilePath, recFolderList=r.recSetting.recFolderList, partialRecFolder=r.recSetting.partialRecFolder, recMode=GetVarInt(post,'recEnabled')~=1 and 5 or GetVarInt(post,'recMode',0,4), noRecMode=GetVarInt(post,'recMode',0,4), tuijyuuFlag=GetVarInt(post,'tuijyuuFlag')==1, priority=GetVarInt(post,'priority',1,5), pittariFlag=GetVarInt(post,'pittariFlag')==1, suspendMode=GetVarInt(post,'suspendMode',0,4), rebootFlag=GetVarInt(post,'rebootFlag')==1, startMargin=useMargin and GetVarInt(post,'startMargin',-6*3600,6*3600), endMargin=useMargin and GetVarInt(post,'endMargin',-6*3600,6*3600), serviceMode=GetVarInt(post,'serviceMode')==1 and 0 or 1+16*(GetVarInt(post,'serviceMode_1',0,1) or 0)+32*(GetVarInt(post,'serviceMode_2',0,1) or 0), continueRecFlag=GetVarInt(post,'continueRecFlag')==1, tunerID=GetVarInt(post,'tunerID'), partialRecFlag=GetVarInt(post,'partialRecFlag',0,1) or 0 } if r.recSetting.recMode and r.recSetting.priority and r.recSetting.suspendMode and (not useMargin or r.recSetting.startMargin and r.recSetting.endMargin) and r.recSetting.tunerID then return edcb.ChgReserveData(r) end end end end return false end vtag=GetVarInt(mg.request_info.query_string,'vtag') or -1 ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE) ct:Append([=[

# 予約詳細

]=]) id=GetVarInt(mg.request_info.query_string,'id') or 0 xq=GetTranscodeQueries(mg.request_info.query_string) post=AssertPost() if post then if mg.get_var(post,'addchg') then ct:Append('
'..(Change(id,post) and '変更しました' or '入力値不正')..'
\n') elseif mg.get_var(post,'del') then rdel=edcb.GetReserveData(id) edcb.DelReserveData(id) ct:Append('
削除しました
\n') end end recFilePath=edcb.GetRecFilePath(id) edcb.htmlEscape=15 r=edcb.GetReserveData(id) if r then epgInfo=ConvertProgramText(edcb.SearchEpg(r.onid,r.tsid,r.sid,r.eid)) dur=r.startTime.hour*3600+r.startTime.min*60+r.startTime.sec+r.durationSecond ct:Append('

\n' ..'
番組情報
  '..(#epgInfo>0 and '\n'..epgInfo:gsub('\r?\n','
  \n') or FormatTimeAndDuration(r.startTime, r.durationSecond)..'
  '..r.stationName..'
  '..r.title..'
  ' ..('OriginalNetworkID:%d(0x%04X)
  '):format(r.onid,r.onid) ..('TransportStreamID:%d(0x%04X)
  '):format(r.tsid,r.tsid) ..('ServiceID:%d(0x%04X)
  '):format(r.sid,r.sid) )..'
\n' ..'
ファイル →Video' or '0">DL')..'
  \n') ref=recFilePath and NativeToDocumentPath(recFilePath) if ref then for i,ext in ipairs({table.unpack(MEDIA_EXTENSION_LIST),''}) do ff=edcb.FindFile(recFilePath..ext,1) if ff then ct:Append((vtag==i and '
  ' ..'
  ' ..'
  ' ..'
  ' ..'/'..EdcbHtmlEscape(ref..ext)..(vtag==i and '
  \n'..VideoScriptTemplete() or '')) if ext=='' then fsec,fsize=0,0 f=edcb.io.open(recFilePath,'rb') if f then fsec,fsize=GetDurationSec(f) f:close() end ct:Append(' ('..('%dm%02ds|'):format(math.floor(fsec/60),fsec%60)..math.floor(fsize/1048576)..'M)
  \n' ..'
  \n' ..(vtag==0 and '\n' or '\n\n') ..'
  \n' ..TranscodeSettingTemplete(xq,fsec) ..'
  ') if vtag==10 then src='xcode.lua?fname='..mg.url_encode(ref)..ConstructTranscodeQueries(xq) ct:Append('\n
  ' ..'
  ' ..'
  ' ..'
  ' ..'xcode
  \n' ..'
  '..src..'
  \n'..TranscodeScriptTemplete(false,{ofssec=fsec*(xq.offset or 0)/100,fast=xq.fast})) if ALLOW_HLS then ct:Append(HlsScriptTemplete()) end end else ct:Append(' ('..math.floor(ff[1].size/1048576)..'M)
  \n') end end end end ct:Append('
\n' ..'
'..(r.eid==65535 and 'プログラム予約' or 'プログラム予約化（プログラム予約化は元に戻せません。番組を特定できなくなるため追従もできません。）') ..'
  \n' ..'
  \n' ..'\n' ..'予約日時: //\n:: ～\n::
  \n' ..'
\n' ..'
プリセット
  \n' ..'
  \n' ..'
\n' ..'
録画設定
  \n' ..'
  \n' ..'\n' ..'\n' ..RecSettingTemplate(rs)..'
\n' ..'
-
  \n' ..'
  \n' ..'\n' ..'\n' ..'
\n' ..'

\n') end r=r or rdel ct:Append([=[
]=]) ct:Finish() mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))